wx.$msg = {
  success(msg: string, duration = 2000) {
    wx.showToast({
      title: msg,
      icon: 'success',
      duration
    })
  },
  error(msg: string, duration = 2000) {
    wx.showToast({
      title: msg,
      icon: msg.length > 7 ? 'none' : 'error',
      duration
    })
  },
  info(msg, duration = 2000) {
    wx.showToast({
      title: msg,
      icon: 'none',
      duration
    })
  },
  loading(msg: string) {
    wx.showLoading({
      title: msg,
      mask: true
    })
  },
  closeLoading() {
    wx.hideLoading()
  }
}